from socket import *
import sys

s = socket(AF_INET, SOCK_STREAM)
hostname = sys.argv[1]
port = 9000
s.connect( (hostname, port) )

instruct = sys.argv[2]

if instruct == 'get':
  s.send('get\n')
  while 1:
    line = s.recv(1024)
    if not line:
      break
    else:
      print line
else:
  message = sys.argv[3]
  s.send("put\n")
  s.send(message + "\n")

